version 14.2
#delimit ;
log using "F:\Government Formation in Asian-Pacific Democracies.log", replace;
set more off;

* ***************************************************************** *;
* ***************************************************************** *;
* File-Name: model4_pp.do *;
* Date: 5/30/2022 *;
* Author: MG *;
* Purpose: Analysis [Coalition Clusters]  *;
* Input File: data_stata_pp.dta *;
* Data Output: None *;
* Previous file: None *;
* Machine: laptop *;
* **************************************************************** *;
* **************************************************************** *;

use "F:\Government Formation in Asian-Pacific Democracies\Portfolio Allocation\data_stata_pp.dta", clear;


gen portfolioshare = . ;

replace portfolioshare = party_port2/gov_port2 ;

gen seatshare = . ;

replace seatshare = party_seats/gov_seats ;

gen parliamentary = . ;
 
replace parliamentary = 1 if presidential ==0 ;

replace parliamentary = 0 if presidential == 1 ;

gen seatshare_parl = . ;

replace seatshare_parl = seatshare * parliamentary ;

gen formateur_parl = . ;

replace formateur_parl = formateur * parliamentary ;

rename h_polcon5_vdem vetoplayers ;

gen seat_vetoplayers = . ;

replace seat_vetoplayers = seatshare * vetoplayers ;

gen vetoplayers_parl = . ;

replace vetoplayers_parl = vetoplayers * parliamentary ;

gen formateur_vetoplayers = . ;

replace formateur_vetoplayers = formateur * vetoplayers ;

gen form_vetoplayers_parl = . ;

replace form_vetoplayers_parl = formateur * vetoplayers * parliamentary ;

gen seat_vetoplayers_parl = . ;

replace seat_vetoplayers_parl = seatshare * vetoplayers * parliamentary ;

************************* ;
*  Summarize variables    ;
************************* ;

sum;

********************************************************************** ;
*  Table 1, Model 4, re-arranged to put seatshare IVs last           ;
* Y = b0 + b1X + b2W + b3Z + b4XW + b5XZ + b6WZ * b7XZW + controls + e ;
*    formateur is X, parliamentary is W, vetoplayers is Z              ;
* formateur_parl =XW, formateur_vetoplayers =XZ, vetoplayers_parl =WZ, ; 
* form_vetoplayers_parl is XWZ, then control variables                 ; 
********************************************************************** ;

regress portfolioshare formateur parliamentary vetoplayers 
formateur_parl formateur_vetoplayers vetoplayers_parl 
form_vetoplayers_parl 
seatshare seatshare_parl seat_vetoplayers seat_vetoplayers_parl, cluster(cabinetcode) ;

log close;
exit;

